From f100d259d2ffebe61fef56ea3964f6d534d598c8 Mon Sep 17 00:00:00 2001 From: Dawid Rycerz Date: Thu, 3 Jul 2025 13:46:07 +0300 Subject: Initial pleroma pull support --- src/pages/micro/[...slug].astro | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) (limited to 'src/pages/micro/[...slug].astro') diff --git a/src/pages/micro/[...slug].astro b/src/pages/micro/[...slug].astro index 2ce847d..54f6234 100644 --- a/src/pages/micro/[...slug].astro +++ b/src/pages/micro/[...slug].astro @@ -1,16 +1,22 @@ --- import { getCollection } from "astro:content"; - +import type { GetStaticPaths, InferGetStaticPropsType } from "astro"; import Note from "@/components/note/Note.astro"; import PageLayout from "@/layouts/Base.astro"; -import type { GetStaticPaths, InferGetStaticPropsType } from "astro"; // if you're using an adaptor in SSR mode, getStaticPaths wont work -> https://docs.astro.build/en/guides/routing/#modifying-the-slug-example-for-ssr export const getStaticPaths = (async () => { - const allNotes = await getCollection("note"); - return allNotes.map((note) => ({ - params: { slug: note.id }, - props: { note }, + // Get both local notes and Pleroma posts + const [allNotes, allMicro] = await Promise.all([ + getCollection("note"), + getCollection("micro").catch(() => []), // Fallback to empty array if micro collection fails + ]); + + const allPosts = [...allNotes, ...allMicro]; + + return allPosts.map((post) => ({ + params: { slug: post.id }, + props: { note: post }, // Keep 'note' name for compatibility with existing component })); }) satisfies GetStaticPaths; -- cgit v1.2.3